<template>
    <slot :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
        <AppCol :layoutOpts="model.layoutOpts">
            <AppPortlet 
                name="dashboard_sysportlet1"
                title="订单明细柱状图" 
                class="app-control-Portlet__parent control-content portalcomponentshistogram " 
                width="100%"
                height="400px"            
                :isShowTitle="model.showTitleBar" 
                :actions="store.actions" 
                :image="{imagePath: model.image.imagePath, cssClass: model.image.imagePath }"  
                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
            >
                <slot name="IBIZOrderDetailHistogramChart" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit }">
                    <IBIZOrderDetailHistogramChart 
                        name="dashboard_sysportlet1_chart"
                        :context="store.context"
                        :viewParams="store.viewParams"
                        style="height: 100%; width: 100%;"
                        :actions="{
                            createAction: 'Create',
                            fetchAction: 'FetchDefault',
                            removeAction: 'Remove',
                            updateAction: 'Update'
                        }"
                        :pViewCtx="store.viewCtx"
                        @ctrl-init="(name: string, ability: any) => { handleCtrlInit(controller, 'dashboard_sysportlet1', ability) }">
                    </IBIZOrderDetailHistogramChart>
                </slot>
            </AppPortlet>
        </AppCol>
    </slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{spinalCase ctrl.parent.codeName}}-{{ctrls@PORTLET}}-portlet/{{spinalCase ctrl.parent.codeName}}-{{spinalCase ctrl.codeName}}-portlet-base.vue.hbs生成
import { AppPortlet, AppPortletContainer } from '@components/widgets/portlet';
import { AppCol } from '@/components/common/col';
import { AppActionBar } from '@/components/common/action-bar';
import { AppRaw } from '@/components/common/raw';
import IBIZOrderDetailHistogramChart from '@widgets/ibiz-order-detail/histogram-chart/histogram-chart.vue';
import { useProps, useBasic, useAction, useController } from './dashboard-viewdashboard-container-1-portal-components-histogram-portlet-hook';
import { IEvent, IViewAbility, ICtrlAbility, PortletActionType, IPortletAbility, IPortletStore, IParam } from "@/core";
// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    controlID, 
    getClassNames, 
    useNavParamsBind, 
    useEventBind, 
    handleCtrlDestroy,
    handleCtrlInit, 
    handleCtrlAction,
    handleToolbarItemClick,
    handleComponentAction
} = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: PortletActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IPortletAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
    return getClassNames(props);
});

const controller = useController(props, evt, { controlID });

const { handleViewInit } = useAction(controller);

useNavParamsBind(controller, props);

const store: IPortletStore = controller.getStore();

onMounted(() => {
    controller.ctrlMounted();
});

onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>